package com.ido.news.splashlibrary.util

import android.content.Context

object SPGlobalConfigMgr {
    private val PREFS_FILE = "dotools_config"
    private val LUN_BO_INDEX = "splashlunboIndex"
    private val VERSION_FLAG = "sp_version_flag"


    /** 记录轮播位置  */
    fun setLunBoIndex(cxt: Context, index: Int) {
        val prefs = cxt.getSharedPreferences(PREFS_FILE, Context.MODE_PRIVATE)
        SharedPreferencesCompat.apply(prefs.edit().putInt(LUN_BO_INDEX, index))
    }

    /**获取轮播位置  */
    fun getLunBoIndex(cxt: Context): Int {
        val prefs = cxt.getSharedPreferences(PREFS_FILE, Context.MODE_PRIVATE)
        return prefs.getInt(LUN_BO_INDEX, 0)
    }

    fun setVersionFlag(context: Context, time: Int) {
        val prefs = context.getSharedPreferences(PREFS_FILE, Context.MODE_PRIVATE)
        SharedPreferencesCompat.apply(prefs.edit().putInt(VERSION_FLAG, time))
    }

    fun getVersionFlag(context: Context): Int {
        val prefs = context.getSharedPreferences(PREFS_FILE, Context.MODE_PRIVATE)
        return prefs.getInt(VERSION_FLAG, -1)
    }



}
